function [T_n,c2_crit95,reject2,pval2] = exog_test_tstat(P_i,Q_i,W_i,K1,K2,a1,a2,b1,b2,p_lb,p_ub,q_lb,q_ub,tau,n,theta_hat,sigma_berkson,h_w,k_type,order_V_Ln)

[BB, ~, ~] = construct_chebyshev_twodim(P_i,Q_i,K1,K2,a1,a2,b1,b2); 

fdist1='Normal';
fdist2='';
alpha1=NaN;
alpha2=NaN;
 
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	% PACK <packobj>
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

packobj.sigma1=sigma_berkson;
packobj.sigma2=0;
packobj.fdist1=fdist1;
packobj.fdist2=fdist2;
packobj.sigma_berkson=sigma_berkson;
packobj.alpha1=alpha1;
packobj.alpha2=alpha2;
packobj.Q_i=Q_i;
packobj.K1=K1;
packobj.K2=K2;
packobj.p_lb=p_lb;
packobj.p_ub=p_ub;
packobj.q_lb=q_lb;
packobj.q_ub=q_ub;

	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	% FIND TEST STATISTIC
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

T_n_inner= @(w) (h_w*n)*(find_S_w(w,P_i,W_i,h_w,BB,theta_hat,k_type,tau,packobj) - tau * find_fhat_w(w,W_i,h_w,k_type)).^2;
T_n=integral(T_n_inner,min(W_i),max(W_i),'AbsTol',0,'RelTol',1e-3); 

	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	% FIND CRITICAL VALUE 
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
[c2_crit95,pval2]=find_crit_val(W_i,tau,order_V_Ln,h_w,k_type,T_n); 
reject2=T_n>c2_crit95;

	%


